package com.exsun.gateway.jt809.kafka;

import exsun.jt808.data.config.CommonMsgTopic;
import exsun.jt808.data.jt809_data.JT809LinkStatus;
import exsun.jt808.data.util.GsonUtils;
import exsun.jt808.data.util.SAContextHolder;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


@Component
public class KafkaProducer {

    @Resource(name="JT809ProducerKafkaTemplate")
    KafkaTemplate kafkaTemplate;

    public void kafkaStatus(JT809LinkStatus status){
        String sendData = GsonUtils.getJsonFromObject(status);
        kafkaTemplate.send(CommonMsgTopic.linkStatus, sendData);
    }
}
